<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .div1 {
            width: 80vw;
            height: 80vh;
            background-color: #56a5f1;
        }
        .p1 {
            font-size: 60px;
        }
        .span2 {
            padding: 1em;
        }
        .p2 {
            font-size: 20px;
        }
        .span22 {
            padding: 1em;
        }
    </style>
</head>
<body>
    <div class="div1"></div>
    <p class="p1">
        <span class="span2">span2</span>
    </p>
    <p class="p2">
        <span class="span22">span22</span>
    </p>
    <script>
        // 移动端的事件
        var touchEvent = {
            // 轻触事件
            tap: function(el, fn) {
                console.log(el);
                // el是触发事件的元素；fn是具体的操作
                el.addEventListener('touchstart', fn, false)
            }
        }
        window.onload = function() {
    
            var div = document.querySelector('.div1');
            touchEvent.tap(div, function() {
                var str = "";
                var e = event;
                console.log(e);
                // console.log(e.touches[0].pageX);
                // console.log(e.touches[0].pageY);
                str += "<p>当前坐标：（"+Math.round(e.touches[0].pageX)+"px ,"+Math.round(e.touches[0].pageY)+"px)</p>"
                div.innerHTML = str;
            })
        }
        </script>
</body>
</html>